import { createApp } from "vue";
import App from "./App.vue";
import router from "@/router";
import { setupStore } from "@/store";
import { setupDirective } from "@/directive";
import { getDistStore } from "@/store/modules/dict";
import print from "vue3-print-nb";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import mitt from "mitt";

import "@/permission";

// 本地SVG图标
import "virtual:svg-icons-register";

// 国际化
import i18n from "@/lang/index";

// 样式
import "element-plus/theme-chalk/dark/css-vars.css";
import "@/common/font.css";
import "@/styles/index.scss";
import "@/styles/app.scss";
import "uno.css";

const Mit = mitt();
//Typescript 注册
//由于必须要扩展ComponentCustomProperties类型才能获取类型提示
declare module "vue" {
  export interface ComponentCustomProperties {
    $Bus: typeof Mit;
  }
}
const app = createApp(App);
// 全局注册 自定义指令(directive)
setupDirective(app);
// 全局注册 状态管理(store)
setupStore(app);
app.use(print);
//app.directive("print", print);
//vue挂载全局api
app.config.globalProperties.$bus = Mit;
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

app.use(router).use(i18n).mount("#app");
//全局获取数据字段
getDistStore();
